#include <iostream>
using namespace std;

class Person
{
	private :
		int age;
	public :
		string sex;
		static int count;
	protected :
		string name;
	public :
		Person(int a = 20, string s = "Boy", string n = "Li Si") :
			age(a), sex(s), name(n)
		{
			cout << "<Person init()>" << endl;
		}

		void display()
		{
			cout << "<display Person>" << endl;
			cout << "Name : " << name << endl;
			cout << "Age  : " << age << endl;
			cout << "Sex  : " << sex << endl;
		}

		static int get_count(void);
};
int Person :: count = 0;

int Person :: get_count(void)
{
	return count;
}

class Student : public Person
{
	private :
		int score;
	public :
		Student(int a = 20, string s = "Girl", string n = "Li Wu", int sc = 90) :
			Person(a, s, n), score(sc)
		{
			cout << "<Student init()>" << endl;
			count++;
		}
		
		//void display_s()
		void display()//display_s()
		{
			cout << "<display Student>" << endl;
			Person :: display();
			cout << "Score: " << score << endl;
		}
};

class Teacher : protected Person
{
	private :
		string course;
	public :
		Teacher(int a = 21, string s = "Boy", string n = "Huang Liu", string c = "English") :
			Person(a, s, n), course(c)
		{
			cout << "<Teacher init()>" << endl;
			count++;
		}

		Teacher(const Teacher& t) :
			Person(t), course(t.course)
		{
			cout << "<Teacher copy()>" << endl;
		}

		Teacher& operator=(const Teacher& t)
		{
			if(this != &t)//&t是取对象的地址
			{
				cout << "<Teacher operator()>" << endl;
				Person :: operator=(t);
				course = t.course;
			}

			return *this;
		}

		//void display_t()
		virtual void display()//display_t()
		{
			cout << "<display Teacher>" << endl;
			Person :: display();
			cout << "Course : " << course << endl;
		}
};

class Cleaner : private Person
{
	private :
		int wage;
	public :
		Cleaner(int a = 22, string s = "Girl", string n = "Zhang San", int w = 1000) :
			Person(a, s, n), wage(w)
		{
			cout << "<Cleaner init()>" << endl;
			count++;
		}

		void display_c()
		{
			cout << "<display Cleaner>" << endl;
			Person :: display();
			cout << "Wage : " << wage << endl;
		}
};

class Assistant_Teacher : public Student, public Teacher
{
	public :
		Assistant_Teacher(int a = 25, string s = "Boy", string n = "Wang Qi", int sc = 95, string c= "English") :
			Student(a, s, n, sc), Teacher(a, s, n , c)
		{
			cout << "<Assistant_Teacher init()>" << endl;
		}

		void display()
		{
			cout << "<Assistant_Teacher>" << endl;
			Student :: display();
			Teacher :: display();
			//display();
			//display();
		}
};
int main()
{
//	Person p1;
	Student s1(20, "Boy", "Xiao Ming", 85);
	Teacher t1(35, "Woman", "Hong Jie", "Chinese");
//	Cleaner c1;
	Assistant_Teacher at1;//b.3
/*
//	p1.display();//a.2

	s1.display_s();
	cout << s1.sex << endl;

	t1.display_t();
//	cout << t1.name << endl;

	c1.display_c();
//	cout << c1.age << endl;
*/
/*
	Person& rs = s1;//a.3
	rs.display();

	Person *ps = new Person;
	ps = &s1;
	ps->display();

//	Person& rt = t1;//不能实现派生类到基类的转换
//	t1.display();

//	Person *pt = new Person;
//	pt = &t1;
//	(*pt).display();
*/
/*
	Teacher t2(t1);//b.1
	t2.display_t();

	Teacher t3;
	t3 = t1;
	t3.display_t();
*/
/*
	cout << "Count = " << p1.get_count() << endl;//b.2
*/
	
//	at1.display();
	Teacher *pt = new Assistant_Teacher;//b.3
	pt->display();

}
